classdef node<handle
    properties
        val
        next;
        parent;
    end
    methods
        function obj=node(val)
            obj.val=val;
        end
        function insert(obj,list)
            for i=1:length(list)
                obj.next=[obj.next,node(list(i))];
                obj.next(i).parent=obj;
            end 
        end
    end
end

